﻿.ant-table {
    @each $name, $value in $theme-colors {
        $background: theme-color-level($name, $table-background-level);
        $border: theme-color-level($name, $table-border-level);

        &-#{$name} {
            &,
            > th,
            > td {
                background-color: $background;
            }

            @if $border != null {
                th,
                td,
                thead th,
                tbody + tbody {
                    border-color: $border;
                }
            }
        }
    }
}

.ant-table-striped {
    tbody tr:nth-of-type(odd) {
        background-color: #fbfbfb;
    }

    thead {
        background-color: #f1f1f1;
    }
}

.ant-table-borderless .ant-table-tbody {
    tr,
    th,
    td,
    thead th,
    tbody + tbody {
        border: 0;
    }
}

.ant-table {
    // disable antdesign default hover effect
    tbody > tr.ant-table-row:hover > td {
        background: unset;
    }
    // enable hover only when specified
    &.ant-table-hover tbody > tr.ant-table-row:hover > td {
        background: #f5f5f5;
    }
}

.ant-table {
    // TODO: add to theme options
    .ant-table-thead-dark {
        th {
            color: var(--b-table-thead-dark-color, #fff);
            background-color: var(--b-table-thead-dark-background, #343a40);
            border-color: var(--b-table-thead-dark-border, #343a40);
        }
    }

    .ant-table-thead-light {
        th {
            color: var(--b-table-thead-light-color, #495057);
            background-color: var(--b-table-thead-light-background, #e9ecef);
            border-color: var(--b-table-thead-light-border, #e9ecef);
        }
    }
}

.ant-table-row-header {
    font-weight: bold;
}

.ant-table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ant-table-responsive > .ant-table-bordered {
    border: 0;
}

.ant-table-fixed-header {
    .ant-table-container{ 
        overflow-y: auto;
    }

    .table {
        border-collapse: separate;
        border-spacing: 0;
    }

    thead tr th {
        border-top: none;
        position: sticky;
        background: white;
        z-index: 1;
    }

    thead tr:nth-child(1) th {
        top: 0;
    }
}

